package com.aididi.service;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @Auther: zx.xu
 * @Description:
 */
@Component
@Slf4j
public class FeignFallbackFactory implements FallbackFactory<ComsumerFeignService>{
    @Override
    public ComsumerFeignService create(Throwable throwable) {
        return name -> {
            log.info("fallback; reason was:", throwable);
            return "sorry:"+name+",i am feign fallback";
        };
    }
}
